package com.miyake.dsp.osa.lab.wrapper;

import com.miyake.dsp.ComplexArray;
import com.miyake.dsp.osa.lab.Calculator;
import com.miyake.dsp.osa.lab.LabUiAnnotation;
@LabUiAnnotation(caption="Power")
public class PowerWrapper extends Calculator {
	public static final String INPUT = "Input";
	public static final String OUTPUT = "Output";
	
	public PowerWrapper() {
		initInput(INPUT);
		initOutput(OUTPUT);
	}
	
	@Override
	public synchronized void process() {
		double[] d = this.getInput(INPUT).getRealPart();
		double[] ret = new double[d.length];
		for (int i = 0; i < d.length; i++) {
			ret[i] = 0.5 * Math.pow(d[i], 2.0);
		}
		this.setOutput(OUTPUT, new ComplexArray(ret));
	}

	@Override
	public Object getSetting() {
		return null;
	}

}
